package com.ruoyi.quality.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.quality.mapper.QualitySupplierMapper;
import com.ruoyi.quality.domain.QualitySupplier;
import com.ruoyi.quality.service.IQualitySupplierService;

/**
 * 供应商管理Service业务层处理
 *
 * @author wky
 * @date 2024-06-05
 */
@Service
public class QualitySupplierServiceImpl implements IQualitySupplierService
{
    @Autowired
    private QualitySupplierMapper qualitySupplierMapper;

    /**
     * 查询供应商管理
     *
     * @param supplierId 供应商管理主键
     * @return 供应商管理
     */
    @Override
    public QualitySupplier selectQualitySupplierBySupplierId(Long supplierId)
    {
        return qualitySupplierMapper.selectQualitySupplierBySupplierId(supplierId);
    }

    /**
     * 查询供应商管理列表
     *
     * @param qualitySupplier 供应商管理
     * @return 供应商管理
     */
    @Override
    public List<QualitySupplier> selectQualitySupplierList(QualitySupplier qualitySupplier)
    {
        return qualitySupplierMapper.selectQualitySupplierList(qualitySupplier);
    }

    /**
     * 新增供应商管理
     *
     * @param qualitySupplier 供应商管理
     * @return 结果
     */
    @Override
    public int insertQualitySupplier(QualitySupplier qualitySupplier)
    {
        qualitySupplier.setCreateTime(DateUtils.getNowDate());
        return qualitySupplierMapper.insertQualitySupplier(qualitySupplier);
    }

    /**
     * 修改供应商管理
     *
     * @param qualitySupplier 供应商管理
     * @return 结果
     */
    @Override
    public int updateQualitySupplier(QualitySupplier qualitySupplier)
    {
        return qualitySupplierMapper.updateQualitySupplier(qualitySupplier);
    }

    /**
     * 批量删除供应商管理
     *
     * @param supplierIds 需要删除的供应商管理主键
     * @return 结果
     */
    @Override
    public int deleteQualitySupplierBySupplierIds(Long[] supplierIds)
    {
        return qualitySupplierMapper.deleteQualitySupplierBySupplierIds(supplierIds);
    }

    /**
     * 删除供应商管理信息
     *
     * @param supplierId 供应商管理主键
     * @return 结果
     */
    @Override
    public int deleteQualitySupplierBySupplierId(Long supplierId)
    {
        return qualitySupplierMapper.deleteQualitySupplierBySupplierId(supplierId);
    }

    @Override
    public List<Map<Long, Long>> getMonthCountMap(Long year) {
        return qualitySupplierMapper.selectMonthCountMap(year);
    }
}
